package resoft.jeasyform.components;

/**
 * <p></p>
 * User: albert
 * Date: Aug 26, 2007
 * Time: 8:04:50 PM
 */
public abstract class Component {


    /**
     * set a rantangle
     * @param x int
     * @param y int
     * @param width int
     * @param height int
     * */
    public void setRectangle(int x,int y,int width,int height) {
        setX(x);
        setY(y);
        setWidth(width);
        setHeight(height);
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }


    public String getAlign() {
        return align;
    }

    public void setAlign(String align) {
        if(align!=null) {
            this.align = align;
        }                              
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public Window getParentWindow() {
        return parentWindow;
    }

    public void setParentWindow(Window parentWindow) {
        this.parentWindow = parentWindow;
    }


    public boolean isAccpetFocus() {
        return accpetFocus;
    }

    protected void setAcceptFocus(boolean accpetFocus) {
        this.accpetFocus = accpetFocus;
    }

    /**
     * to swing object
     * @return charva.awt.Component
     * */
    public abstract charva.awt.Component getSwingObject() ;

    /**
     * hide
     * */
    public abstract void hide();

    /**
     * show
     * */
    public abstract void show();



    private int x;
    private int y;
    private int width;
    private int height = 1;
    private String align = "left";
    private String name = "";
    private Window parentWindow;
    private boolean accpetFocus = false;

}
